﻿
using RestSharp;
using System.Net;
using System.Text;

namespace WebAPIClient
{
    public class WebAPIClient
    {
        static string url = "http://localhost:5000/PaddleOCR/DetectText";
      
        public   static string DetectText(string base64)
        {
            RestClient client = new RestClient(url);
            RestRequest req = new RestRequest() { Method = Method.Post };
            req.AddBody(base64);
            req.AddHeader("Content-Type", "application/json");
            var resp = client.ExecuteAsync(req);

            if (resp.Result.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("HttpError：" + resp.Result.StatusDescription);
            }
            return resp.Result.Content;
        }

    }
}
